export function formatTime(timestampStr, format = 'yyyy-mm-dd') {
  const timestamp = timestampStr.length <= 10 ? Number(timestampStr) * 1000 : Number(timestampStr);
  const date = new Date(timestamp);

  // 2. 提取日期组件并补零
  const year = date.getFullYear();
  const month = String(date.getMonth() + 1).padStart(2, '0');
  const day = String(date.getDate()).padStart(2, '0');

  // 3. 替换格式占位符
  return format
    .replace('yyyy', year)
    .replace('mm', month)
    .replace('dd', day);
}